package com.huawei.chenxuan;
import java.util.Scanner;
import java.util.Random;
public class report1 {
    public static void main(String args[]) {
                System.out.println("程序已启动，欢迎进入游戏");
                System.out.println("请输入剪刀/石头/布：");
                Scanner person = new Scanner(System.in);
                int a = 0, b = 0, c = 3 - a - b;
                for (int i = 1; i < 4; i++) {
                    System.out.println("第" + i + "局");
                    String enter = person.next();//用户输入的数据
                    int randomNumber = new Random().nextInt(3);
                    if (enter.equals("剪刀")) {
                        if (randomNumber == 1) {
                            System.out.println("电脑出的是剪刀");
                            System.out.println("平局");
                            a++;
                        } else if (randomNumber == 2) {
                            System.out.println("电脑出的是布");
                            System.out.println("你赢了");
                            b++;
                        } else if (randomNumber == 3) {
                            System.out.println("电脑出的是石头");
                            System.out.println("你输了");

                        }
                    } else if (enter.equals("布")) {
                        if (randomNumber == 1) {
                            System.out.println("电脑出的是剪刀");
                            System.out.println("你输了");

                        } else if (randomNumber == 2) {
                            System.out.println("电脑出的是布");
                            System.out.println("平局");
                            a++;
                        } else if (randomNumber == 3) {
                            System.out.println("电脑出的是石头");
                            System.out.println("你赢了");
                            b++;
                        }
                    } else if (enter.equals("石头")) {
                        if (randomNumber == 1) {
                            System.out.println("电脑出的是剪刀");
                            System.out.println("你赢了");
                            b++;
                        } else if (randomNumber == 2) {
                            System.out.println("电脑出的是布");
                            System.out.println("你输了");

                        } else if (randomNumber == 3) {
                            System.out.println("电脑出的是石头");
                            System.out.println("平局");
                            a++;

                        }
                    } else {
                        System.out.println("请输入正确的格式");
                    }
                }
                System.out.println("你赢下了" + b + "局,平了" + a + "局");
                if (a > b) {
                    System.out.println("你赢了");
                } else if (a == c) {
                    System.out.println("你与电脑平局了");
                } else {
                    System.out.println("你输了");
                }

            }
        }
